﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace FaceApp.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult TestFace()
        {
            var APP_ID = "10363657";
            var API_KEY = "2pq0I58jp5lMwKVUd08xGojI";
            var SECRET_KEY = "SSP592rOfyZzRoh3DXGDx5iWWUIOMq8i";
            var client = new Baidu.Aip.Face.Face(API_KEY, SECRET_KEY);
            var image = System.IO.File.ReadAllBytes(@"D:\Documents\Downloads\timg.jpg");
            var options = new Dictionary<string, object>(){
                {"face_fields","beauty,age"}
            };
            //var result = client.FaceDetect(image, options);
            var result = client.User.Register(image, "1", "testuser", new[] { "1" });
            return Json(new { ret = result });
        }       
    }
}